import React, {Component} from 'react'



export default class ConButton extends Component {
    constructor(props) {
        super(props)
        this.state = {
           userName: 'react-router',
           location:[
               {area:'苏州',provience:'江苏'},
               {area:'武汉',provience:'湖北'},
               {area:'合肥',provience:'安徽'},
               {area:'厦门',provience:'福建'},
               {area:'深圳',provience:'广东'},
           ],
        }
    }

    // 进入当前组件时调用
    componentWillMount() {
      console.log('当前时间====》',new Date().toLocaleDateString());
      console.log('this.props===>',this.props);
    }
    render() {
        const liStyle = {
            padding:'10px',
            color:  'green'
        }
        return (
            <div>
                <h2>哈哈 这里是另外一个合成的组件 </h2>
                <nav>
                   <ul>热点新闻</ul> 
                   <ul>教学菜单</ul> 
                </nav>
                <menu>{this.state.userName}</menu>
                <ul style={{listStyle:'none'}}>
                    {this.state.location.map((item,index)=> {
                        return (
                          <li style={liStyle} key={index}>{item.area}</li>
                        )
                    })}
                </ul>
            </div>
        )
    }
}